package com.kd.spring.unit;

import org.junit.Test;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.kd.spring.model.BeanLife;

public class testBeanLife{
	
	@Test
	public void testBeanLife(){
		ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml");
		BeanLife beanLife = (BeanLife) applicationContext.getBean("beanLife");
		System.out.println(beanLife);
		
		applicationContext.close();  //当上下文关闭的时候，会销毁bean
	}

	
	
}
